package cn.com.godliu.gateway.controller;

import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestController
public class Circuit {

    //断路器的回调
    @GetMapping("/inCaseOfFailureUseThis")
    public String inCaseOfFailureUseThis() {
        log.info("slow happen");
        Map<String, String> map = new HashMap<>();
        map.put("code", "10002");
        map.put("msg", "系统繁忙，请稍后重试");
        return new Gson().toJson(map);
    }
}
